// src/api/api.ts
import request from "@/utils/request";

/**
 * 获取仓库列表
 * @param data
 * @returns
 */
export const getWarehouseListApi = (params: any) => {
  return request({
    url: "/api/warehouse/list",
    method: "GET",
    params: params,
  });
};

/**
 * 新建或者更新仓库
 * @param data
 * @returns
 */
export const saveOrUpdateWarehouseApi = (data: any) => {
  return request({
    url: "/api/warehouse/saveOrUpdate",
    method: "POST",
    data: data,
  });
};

/**
 * 删除仓库
 * @param id '仓库Id'
 * @returns
 */
export const deleteWarehouseApi = (id: number) => {
  return request({
    url: `/api/warehouse/delete/${id}`,
    method: "DELETE",
  });
};

/**
 * 获取单个仓库
 * @param id
 * @returns
 */
export const getWarehouseByIdApi = (id: number) => {
  return request({
    url: `/api/warehouse/getWarehouse/${id}`,
    method: "GET",
  });
};

/**
 * 根据负责人ID获取单个仓库
 * @param id
 * @returns
 */
export const getWarehousesByManagerApi = (id: number) => {
  return request({
    url: `/api/warehouse/getWarehousesByManager/${id}`,
    method: "GET",
  });
};

/**
 * 根据仓库名查询仓库已有商品
 * @param id
 * @returns
 */
export const getGoodsInWarehouseApi = (id: number) => {
  return request({
    url: `/api/warehouse/getGoodsInWarehouse/${id}`,
    method: "GET",
  });
};
